package aeolus.wind.spider.biz.dataobject;

import aeolus.wind.spider.biz.constants.Constants;

import com.sleepycat.persist.model.Entity;
import com.sleepycat.persist.model.PrimaryKey;
import com.sleepycat.persist.model.Relationship;
import com.sleepycat.persist.model.SecondaryKey;

@Entity
public class Vote {

    /**
     * 自动生成主键
     */
    @PrimaryKey
    private String id;

    /**
     * 被投票者
     */
    @SecondaryKey(relate = Relationship.MANY_TO_ONE)
    private String identityNameBeVoted;
    /**
     * 对某能力投票
     */
    private String abilityName;
    /**
     * 投票者
     */
    @SecondaryKey(relate = Relationship.MANY_TO_ONE)
    private String identityNameVote;
    /**
     * 投票所属领导者
     */
    @SecondaryKey(relate = Relationship.MANY_TO_ONE)
    private String ownIdentityName;
    /**
     * 所投分值
     */
    private int    value;

    public Vote() {
        // TODO Auto-generated constructor stub
    }

    public String getId() {
        setId();
        return id;
    }

    public void setId() {
        id = new StringBuffer().append(identityNameBeVoted).append(Constants.PK_SEP).append(abilityName).append(Constants.PK_SEP).append(identityNameVote).append(Constants.PK_SEP).append(ownIdentityName).toString();
    }

    public String getAbilityName() {
        return abilityName;
    }

    public void setAbilityName(String abilityName) {
        this.abilityName = abilityName;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    public String getIdentityNameBeVoted() {
        return identityNameBeVoted;
    }

    public void setIdentityNameBeVoted(String identityNameBeVoted) {
        this.identityNameBeVoted = identityNameBeVoted;
    }

    public String getIdentityNameVote() {
        return identityNameVote;
    }

    public void setIdentityNameVote(String identityNameVote) {
        this.identityNameVote = identityNameVote;
    }

    public String getOwnIdentityName() {
        return ownIdentityName;
    }

    public void setOwnIdentityName(String ownIdentityName) {
        this.ownIdentityName = ownIdentityName;
    }

}
